package com.fzg.controller;


import com.fzg.common.enums.ResponseWrapper;
import com.fzg.common.model.collection.param.GetCurrentUserCollectionParam;
import com.fzg.common.model.collection.param.UserCollectionParam;
import com.fzg.service.UserCollectionComrecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fzg
 * @since 2022-03-25
 */
@RestController
@RequestMapping("/user-collection-comrecruit")
public class UserCollectionComrecruitController {

    @Autowired
    private UserCollectionComrecruitService userCollectionComrecruitService;

    /**
     * 通过当前登陆的账号查询收藏列表
     * @param param 参数类
     * @return ResponseWrapper
     */
    @GetMapping("/getCurrentUserCollection")
    public ResponseWrapper getCurrentUserCollection(@Validated GetCurrentUserCollectionParam param){
        return userCollectionComrecruitService.getCurrentUserCollection(param);
    }

    /**
     * 用户收藏公司的岗位信息
     * @param param 参数类
     * @return ResponseWrapper
     */
    @PostMapping("/userCollection")
    public ResponseWrapper userCollection(@RequestBody UserCollectionParam param){
        return userCollectionComrecruitService.userCollection(param);
    }

    /**
     * 判断当前这个职位是否被收藏
     * @param param 参数类
     * @return ResponseWrapper
     */
    @GetMapping("/checkThisWorkIsCollection")
    public ResponseWrapper checkThisWorkIsCollection(UserCollectionParam param){
        return userCollectionComrecruitService.checkThisWorkIsCollection(param);
    }

    /**
     * 取消收藏
     * @param param 参数类
     * @return ResponseWrapper
     */
    @PostMapping("/cancelCollection")
    public ResponseWrapper cancelCollection(@RequestBody UserCollectionParam param){
        return userCollectionComrecruitService.cancelCollection(param);
    }

}
